Skip to content

Replace |& with 2>&1 in ignore_free_hooks test. #100004

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

amykhuang
Copy link
Collaborator

The test file ignore_free_hooks.cpp (added in https://github.com/llvm/llvm-project/pull/96749/files) fails on mac because |& doesn't work on mac. Replace with 2>&1.

@amykhuang amykhuang requested a review from hctim July 22, 2024 23:34
@llvmbot llvmbot added compiler-rt compiler-rt:asan Address sanitizer compiler-rt:hwasan Hardware-assisted address sanitizer compiler-rt:sanitizer labels Jul 22, 2024
@llvmbot
Copy link
Member

llvmbot commented Jul 22, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Amy Huang (amykhuang)

Changes

The test file ignore_free_hooks.cpp (added in https://github.com/llvm/llvm-project/pull/96749/files) fails on mac because |& doesn't work on mac. Replace with 2>&1.


Full diff: https://github.com/llvm/llvm-project/pull/100004.diff

2 Files Affected:

  • (modified) compiler-rt/test/asan/TestCases/Posix/ignore_free_hook.cpp (+6-6)
  • (modified) compiler-rt/test/hwasan/TestCases/Posix/ignore_free_hook.cpp (+4-4)
diff --git a/compiler-rt/test/asan/TestCases/Posix/ignore_free_hook.cpp b/compiler-rt/test/asan/TestCases/Posix/ignore_free_hook.cpp
index 3266eef826eda..87be90014d56e 100644
--- a/compiler-rt/test/asan/TestCases/Posix/ignore_free_hook.cpp
+++ b/compiler-rt/test/asan/TestCases/Posix/ignore_free_hook.cpp
@@ -1,15 +1,15 @@
 // RUN: %clangxx_asan -O2 %s -o %t -DTEST=basic_hook_works && not %run %t \
-// RUN:   |& FileCheck %s -check-prefix=CHECK-BASIC
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-BASIC
 // RUN: %clangxx_asan -O2 %s -o %t -DTEST=ignore && %run %t \
-// RUN:   |& FileCheck %s -check-prefix=CHECK-IGNORE
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-IGNORE
 // RUN: %clangxx_asan -O2 %s -o %t -DTEST=ignore_twice && not %run %t \
-// RUN:   |& FileCheck %s -check-prefix=CHECK-IGNORE-2
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-IGNORE-2
 // RUN: %clangxx_asan -O2 %s -o %t -DTEST=mismatch && %env_asan_opts=alloc_dealloc_mismatch=1 not %run %t \
-// RUN:   |& FileCheck %s -check-prefix=CHECK-MISMATCH
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-MISMATCH
 // RUN: %clangxx_asan -O2 %s -o %t -DTEST=ignore_mismatch && %env_asan_opts=alloc_dealloc_mismatch=1 %run %t \
-// RUN:   |& FileCheck %s -check-prefix=CHECK-IGNORE-MISMATCH
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-IGNORE-MISMATCH
 // RUN: %clangxx_asan -O2 %s -o %t -DTEST=double_delete && not %run %t \
-// RUN:   |& FileCheck %s -check-prefix=CHECK-DOUBLE-DELETE
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-DOUBLE-DELETE
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/compiler-rt/test/hwasan/TestCases/Posix/ignore_free_hook.cpp b/compiler-rt/test/hwasan/TestCases/Posix/ignore_free_hook.cpp
index b6f17d89083b4..8c48654f84c0a 100644
--- a/compiler-rt/test/hwasan/TestCases/Posix/ignore_free_hook.cpp
+++ b/compiler-rt/test/hwasan/TestCases/Posix/ignore_free_hook.cpp
@@ -1,11 +1,11 @@
 // RUN: %clangxx_hwasan -O2 %s -o %t -DTEST=basic_hook_works && not %run %t \
-// RUN:   |& FileCheck %s -check-prefix=CHECK-BASIC
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-BASIC
 // RUN: %clangxx_hwasan -O2 %s -o %t -DTEST=ignore && %run %t \
-// RUN:   |& FileCheck %s -check-prefix=CHECK-IGNORE
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-IGNORE
 // RUN: %clangxx_hwasan -O2 %s -o %t -DTEST=ignore_twice && not %run %t \
-// RUN:   |& FileCheck %s -check-prefix=CHECK-IGNORE-2
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-IGNORE-2
 // RUN: %clangxx_hwasan -O2 %s -o %t -DTEST=double_delete && not %run %t \
-// RUN:   |& FileCheck %s -check-prefix=CHECK-DOUBLE-DELETE
+// RUN:   2>&1 | FileCheck %s -check-prefix=CHECK-DOUBLE-DELETE
 
 #include <sanitizer/hwasan_interface.h>
 #include <stdio.h>

@amykhuang amykhuang requested a review from vitalybuka July 22, 2024 23:36
@amykhuang amykhuang merged commit 404ca22 into llvm:main Jul 23, 2024
11 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 23, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-aarch64-linux running on sanitizer-buildbot7 while building compiler-rt at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/51/builds/1634

Here is the relevant piece of the build log for the reference:

Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
[166/169] Generating Msan-aarch64-with-call-Test
[167/169] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.aarch64.o
[168/169] Generating Msan-aarch64-Test
[168/169] Running compiler_rt regression tests
llvm-lit: /b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/discovery.py:276: warning: input '/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/interception/Unit' contained no tests
llvm-lit: /b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/discovery.py:276: warning: input '/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/Unit' contained no tests
llvm-lit: /b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/discovery.py:276: warning: input '/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/rtsan/AARCH64LinuxConfig' contained no tests
llvm-lit: /b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 5515 tests, 48 workers --
Testing:  0.. 10.. 20.. 30
FAIL: LeakSanitizer-Standalone-aarch64 :: TestCases/use_registers.cpp (1878 of 5515)
******************** TEST 'LeakSanitizer-Standalone-aarch64 :: TestCases/use_registers.cpp' FAILED ********************
Exit Code: 23

Command Output (stdout):
--
Test alloc: 0x51a000000000 

=================================================================
==2399353==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1337 byte(s) in 1 object(s) allocated from:
    #0 0xb93f680ed438 in malloc /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/lib/lsan/lsan_interceptors.cpp:75:3
    #1 0xb93f680f08a8 in registers_thread_func /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/use_registers.cpp:16:13
    #2 0xb93f680efb10 in void* ThreadStartFunc<false>(void*) /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/lib/lsan/lsan_interceptors.cpp:434:18
    #3 0xfe9540eeba48  (/lib/aarch64-linux-gnu/libc.so.6+0xeba48) (BuildId: 3119d7bcf68a34e21742cd08095272de601d373f)

Objects leaked above:
0x51a000000000 (1337 bytes)

SUMMARY: LeakSanitizer: 1337 byte(s) leaked in 1 allocation(s).

--
Command Output (stderr):
--
RUN: at line 2: /b/sanitizer-aarch64-linux/build/build_default/./bin/clang  --driver-mode=g++ -O0   -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   -gline-tables-only -fsanitize=leak -I/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/../ -pthread /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/use_registers.cpp -o /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp
+ /b/sanitizer-aarch64-linux/build/build_default/./bin/clang --driver-mode=g++ -O0 -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -gline-tables-only -fsanitize=leak -I/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/../ -pthread /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/use_registers.cpp -o /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp
RUN: at line 3: env LSAN_OPTIONS=:detect_leaks=1:"report_objects=1:use_stacks=0:use_registers=0" not  /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp 2>&1 | FileCheck /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/use_registers.cpp
+ FileCheck /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/use_registers.cpp
+ env LSAN_OPTIONS=:detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0 not /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp
RUN: at line 4: env LSAN_OPTIONS=:detect_leaks=1:"report_objects=1:use_stacks=0:use_registers=1"  /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp 2>&1
+ env LSAN_OPTIONS=:detect_leaks=1:report_objects=1:use_stacks=0:use_registers=1 /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 

3 warning(s) in tests
Step 9 (test compiler-rt symbolizer) failure: test compiler-rt symbolizer (failure)
...
[166/169] Generating Msan-aarch64-with-call-Test
[167/169] Generating MSAN_INST_TEST_OBJECTS.msan_test.cpp.aarch64.o
[168/169] Generating Msan-aarch64-Test
[168/169] Running compiler_rt regression tests
llvm-lit: /b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/discovery.py:276: warning: input '/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/interception/Unit' contained no tests
llvm-lit: /b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/discovery.py:276: warning: input '/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/sanitizer_common/Unit' contained no tests
llvm-lit: /b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/discovery.py:276: warning: input '/b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/rtsan/AARCH64LinuxConfig' contained no tests
llvm-lit: /b/sanitizer-aarch64-linux/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 5515 tests, 48 workers --
Testing:  0.. 10.. 20.. 30
FAIL: LeakSanitizer-Standalone-aarch64 :: TestCases/use_registers.cpp (1878 of 5515)
******************** TEST 'LeakSanitizer-Standalone-aarch64 :: TestCases/use_registers.cpp' FAILED ********************
Exit Code: 23

Command Output (stdout):
--
Test alloc: 0x51a000000000 

=================================================================
==2399353==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 1337 byte(s) in 1 object(s) allocated from:
    #0 0xb93f680ed438 in malloc /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/lib/lsan/lsan_interceptors.cpp:75:3
    #1 0xb93f680f08a8 in registers_thread_func /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/use_registers.cpp:16:13
    #2 0xb93f680efb10 in void* ThreadStartFunc<false>(void*) /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/lib/lsan/lsan_interceptors.cpp:434:18
    #3 0xfe9540eeba48  (/lib/aarch64-linux-gnu/libc.so.6+0xeba48) (BuildId: 3119d7bcf68a34e21742cd08095272de601d373f)

Objects leaked above:
0x51a000000000 (1337 bytes)

SUMMARY: LeakSanitizer: 1337 byte(s) leaked in 1 allocation(s).

--
Command Output (stderr):
--
RUN: at line 2: /b/sanitizer-aarch64-linux/build/build_default/./bin/clang  --driver-mode=g++ -O0   -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta   -gline-tables-only -fsanitize=leak -I/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/../ -pthread /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/use_registers.cpp -o /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp
+ /b/sanitizer-aarch64-linux/build/build_default/./bin/clang --driver-mode=g++ -O0 -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -gline-tables-only -fsanitize=leak -I/b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/../ -pthread /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/use_registers.cpp -o /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp
RUN: at line 3: env LSAN_OPTIONS=:detect_leaks=1:"report_objects=1:use_stacks=0:use_registers=0" not  /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp 2>&1 | FileCheck /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/use_registers.cpp
+ FileCheck /b/sanitizer-aarch64-linux/build/llvm-project/compiler-rt/test/lsan/TestCases/use_registers.cpp
+ env LSAN_OPTIONS=:detect_leaks=1:report_objects=1:use_stacks=0:use_registers=0 not /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp
RUN: at line 4: env LSAN_OPTIONS=:detect_leaks=1:"report_objects=1:use_stacks=0:use_registers=1"  /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp 2>&1
+ env LSAN_OPTIONS=:detect_leaks=1:report_objects=1:use_stacks=0:use_registers=1 /b/sanitizer-aarch64-linux/build/build_default/runtimes/runtimes-bins/compiler-rt/test/lsan/AARCH64LsanConfig/TestCases/Output/use_registers.cpp.tmp

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..

3 warning(s) in tests

yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
Summary:
The test file ignore_free_hooks.cpp (added in
https://github.com/llvm/llvm-project/pull/96749/files) fails on mac
because `|&` doesn't work on mac. Replace with `2>&1`.

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60250805
@amykhuang amykhuang deleted the ignore-free-hooks branch April 2, 2025 17:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-rt:asan Address sanitizer compiler-rt:hwasan Hardware-assisted address sanitizer compiler-rt:sanitizer compiler-rt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants